package com.danbay.cloud.device.mapper.electricmeter;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.danbay.cloud.device.api.dto.electricmeter.EmConsumptionDto;
import com.danbay.cloud.device.api.dto.electricmeter.EmConsumptionBetweenDto;
import com.danbay.cloud.device.entity.electricmeter.EmConsumption;
import org.springframework.stereotype.Repository;

@Repository
public interface EmConsumptionMapper extends BaseMapper<EmConsumption> {

    /**
     * 保存一条数据，如果存在，则忽略
     *
     * @param emConsumption
     * @return
     */
    @Override
    Integer insert(EmConsumption emConsumption);

    /**
     * 根据deviceId和开始结束时间获取用电明细（返回的数据以小时计）
     *
     * @param consumptionQueryDto
     * @return
     */
    EmConsumptionDto selectConsumptionForDate(EmConsumptionBetweenDto consumptionQueryDto);

    /**
     * 根据deviceId和开始结束时间获取用电明细（返回的数据以天计）
     *
     * @param consumptionQueryDto
     * @return
     */
    EmConsumptionDto selectConsumptionForMonth(EmConsumptionBetweenDto consumptionQueryDto);

    /**
     * 根据deviceId和开始结束时间获取用电明细（返回的数据以月计）
     *
     * @param consumptionQueryDto
     * @return
     */
    EmConsumptionDto selectConsumptionForYear(EmConsumptionBetweenDto consumptionQueryDto);

    /**
     * 获取某个时间段的用电量
     *
     * @param consumptionQueryDto
     * @return
     */
    Double selectConsumptionBetween(EmConsumptionBetweenDto consumptionQueryDto);
}
